feat(tokens): support optional metadata on client token creation#87
Merged
AdirAmsalem merged 1 commit intomainfrom Feb 22, 2026
Merged
feat(tokens): support optional metadata on client token creation#87AdirAmsalem merged 1 commit intomainfrom
AdirAmsalem merged 1 commit intomainfrom
Conversation
Add CreateTokenOptions type with optional metadata field to tokens.create(). Always sends application/json, includes metadata key only when provided. Exported new type from package index. Includes 2 new unit tests verifying metadata forwarding and empty-body behavior.
commit: |
tomershlasky
approved these changes
Feb 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CreateTokenOptionstype with optionalmetadata: Record<string, unknown>fieldtokens.create()now accepts optional metadata, always sendsapplication/json, includesmetadatakey only when providedCreateTokenOptionstype from package indexTests
Usage
Note
Low Risk
Small, backwards-compatible SDK surface change limited to the tokens endpoint request shape and headers, with added tests to lock behavior.
Overview
Adds optional metadata support to client token creation by changing
tokens.create()to acceptCreateTokenOptionsand POST a JSON body containingmetadataonly when provided (while always settingcontent-type: application/json).Exports
CreateTokenOptionsfrom the package index and adds unit coverage to verify metadata forwarding and the empty{}body behavior when no metadata is supplied.Written by Cursor Bugbot for commit 0bfd033. This will update automatically on new commits. Configure here.